package com.can.Mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.can.domain.po.User;
import com.can.domain.vo.WodeVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;


@Mapper
public interface UserMapper extends BaseMapper<User> {
    @Select("""
        select 
            id,
            username,
            email,
            DATE_FORMAT(created_at, '%Y/%c/%e') AS createdAt,
            power,
            points
        from users
        where id = #{id}
        """)
    WodeVo wode(int id);

    @Update("""
        update users set points  = points + 3 where id = #{id}""")
    void updatePoints(int id);
}
